// pages/user/detailnsurance/index.js
import urls from '../../../requestUrl.js'
import request from '../../../baseRequest.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  /**获取订单服务负责人信息 */
  getLeaderInfo() {
    let param = {
      'openid': this.data.openid
    }
    request.postRequest(urls.insuranceManger.getMangerInfo, param, (res) => {
      let info = res
      let businessLicense = []
      if (info.businessLicense) businessLicense.push(info.businessLicense)
      info.businessLicense = businessLicense
      let applicants = []
      if (info.applicants) applicants.push(info.applicants)
      info.applicants = applicants
      let companyLogo = []
      if (info.companyLogo) companyLogo.push(info.companyLogo)
      info.companyLogo = companyLogo
      info.companyRegion = info.companyRegion ? info.companyRegion.split(',') : null
      this.setData({
        info: info
      })
    }, () => {})
  },
  /**前往修改页面 */
  handleToEditInfo() {
    wx.navigateTo({
      url: '/pages/user/registerInsurance/index?type=2',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.data.openid = getApp().getUserOpenid()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    this.getLeaderInfo()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})
